package com.cmict.data.form.api.dal.mysql.info;
import java.util.*;

import com.cmict.data.framework.common.pojo.PageResult;
import com.cmict.data.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cmict.data.framework.mybatis.core.mapper.BaseMapperX;
import com.cmict.data.form.api.dal.dataobject.info.MdColumnsDO;
import com.cmict.data.form.api.entity.vo.MdColumnsExportReqVO;
import com.cmict.data.form.api.entity.vo.MdColumnsPageReqVO;
import org.apache.ibatis.annotations.Mapper;
/**
 * 字段信息 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface MdColumnsMapper extends BaseMapperX<MdColumnsDO> {

    default PageResult<MdColumnsDO> selectPage(MdColumnsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MdColumnsDO>()
                .eqIfPresent(MdColumnsDO::getTableId, reqVO.getTableId())
                .likeIfPresent(MdColumnsDO::getColumnName, reqVO.getColumnName())
                .eqIfPresent(MdColumnsDO::getOrdinalPosition, reqVO.getOrdinalPosition())
                .eqIfPresent(MdColumnsDO::getIsNullable, reqVO.getIsNullable())
                .eqIfPresent(MdColumnsDO::getNumericPrecision, reqVO.getNumericPrecision())
                .eqIfPresent(MdColumnsDO::getNumericScale, reqVO.getNumericScale())
                .eqIfPresent(MdColumnsDO::getDatetimePrecision, reqVO.getDatetimePrecision())
                .likeIfPresent(MdColumnsDO::getCharacterSetName, reqVO.getCharacterSetName())
                .eqIfPresent(MdColumnsDO::getColumnType, reqVO.getColumnType())
                .eqIfPresent(MdColumnsDO::getColumnKey, reqVO.getColumnKey())
                .eqIfPresent(MdColumnsDO::getColumnComment, reqVO.getColumnComment())
                .eqIfPresent(MdColumnsDO::getGmtCreate, reqVO.getGmtCreate())
                .eqIfPresent(MdColumnsDO::getGmtModified, reqVO.getGmtModified())
                .eqIfPresent(MdColumnsDO::getIsDeleted, reqVO.getIsDeleted())
                .likeIfPresent(MdColumnsDO::getQualifieldName, reqVO.getQualifieldName())
                .likeIfPresent(MdColumnsDO::getPrefixName, reqVO.getPrefixName())
                .orderByDesc(MdColumnsDO::getId));
    }

    default List<MdColumnsDO> selectList(MdColumnsExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MdColumnsDO>()
                .eqIfPresent(MdColumnsDO::getTableId, reqVO.getTableId())
                .likeIfPresent(MdColumnsDO::getColumnName, reqVO.getColumnName())
                .eqIfPresent(MdColumnsDO::getOrdinalPosition, reqVO.getOrdinalPosition())
                .eqIfPresent(MdColumnsDO::getIsNullable, reqVO.getIsNullable())
                .eqIfPresent(MdColumnsDO::getNumericPrecision, reqVO.getNumericPrecision())
                .eqIfPresent(MdColumnsDO::getNumericScale, reqVO.getNumericScale())
                .eqIfPresent(MdColumnsDO::getDatetimePrecision, reqVO.getDatetimePrecision())
                .likeIfPresent(MdColumnsDO::getCharacterSetName, reqVO.getCharacterSetName())
                .eqIfPresent(MdColumnsDO::getColumnType, reqVO.getColumnType())
                .eqIfPresent(MdColumnsDO::getColumnKey, reqVO.getColumnKey())
                .eqIfPresent(MdColumnsDO::getColumnComment, reqVO.getColumnComment())
                .eqIfPresent(MdColumnsDO::getGmtCreate, reqVO.getGmtCreate())
                .eqIfPresent(MdColumnsDO::getGmtModified, reqVO.getGmtModified())
                .eqIfPresent(MdColumnsDO::getIsDeleted, reqVO.getIsDeleted())
                .likeIfPresent(MdColumnsDO::getQualifieldName, reqVO.getQualifieldName())
                .likeIfPresent(MdColumnsDO::getPrefixName, reqVO.getPrefixName())
                .orderByDesc(MdColumnsDO::getId));
    }

}
